using System;
using System.ComponentModel.DataAnnotations;
using HengTong.Model.Db.Hr.Attendance;
using JetBrains.Annotations;
using WalkingTec.Mvvm.Core;

namespace HengTong.Model.Request;

/// <summary>
/// 批量添加排班记录
/// </summary>
public class AddAttendanceRecordsRequest
{
    [Display(Name = "人员")] public Guid[] PersonIds { get; set; }

    /// <summary>
    /// 排班日期
    /// </summary>
    [Display(Name = "排班日期")]
    [Obsolete("即将弃用, 请使用DateRange")]
    public DateTime ShiftDate { get; set; }

    /// <summary>
    /// 考勤组ID
    /// </summary>
    [Display(Name = "考勤组")]
    [Required]
    public Guid? AttendanceShiftGroupId { get; set; }

    /// <summary>
    /// 排班日期, 由单个日期修改为日期范围
    /// </summary>
    [Display(Name = "日期范围")]
    public DateRange DateRange { get; set; }

    /// <summary>
    /// 是否自动计算未来排班, 如果班次类型为正常上班且选择了考勤组, 则自动计算未来90天排班
    /// </summary>
    [Display(Name = "自动计算未来排班")]
    public bool AutoCalculateFuture { get; set; }

    /// <summary>
    /// 排班类型, 替班和换班仅允许单人单日操作
    /// </summary>
    [Display(Name = "班次类型")]
    [Required]
    public ShiftAction ShiftType { get; set; }

    /// <summary>
    /// 获取或设置换班关联ID
    /// 列表数据通过/api/SysAttendanceRecord/SearchByPerson获取
    /// </summary>
    /// <value>换班关联的另一个班次记录ID，用于建立换班关系</value>
    [Display(Name = "换班关联", Description = "换班关联的另一个班次记录，用于建立换班关系", GroupName = "换班信息")]
    public Guid? SwapShiftId { get; set; }

    /// <summary>
    /// 获取或设置替班人员ID
    /// 列表数据通过/api/SysPerson/Search获取
    /// </summary>
    /// <value>替班的人员ID，仅在班次类型为替班时有效</value>
    [Display(Name = "替班人员", Description = "替班的人员，仅在班次类型为替班时有效", GroupName = "替班信息")]
    public Guid? SubstitutePersonId { get; set; }

    /// <summary>
    /// 备注, 通常用来设置人工修改原因
    /// </summary>
    [Display(Name = "备注")]
    public string Remark { get; set; }
}

/// <summary>
/// 班次类型枚举
/// </summary>
/// <remarks>
/// 定义不同的班次安排类型
/// </remarks>
public enum ShiftAction
{
    /// <summary>
    /// 排班
    /// </summary>
    [Display(Name = "排班")] 排班 = 1,

    /// <summary>
    /// 请假：员工申请的各类假期
    /// </summary>
    [Display(Name = "请假")] 请假 = 2,

    /// <summary>
    /// 调休：调整休息时间
    /// </summary>
    [Display(Name = "调休")] 调休 = 3,

    /// <summary>
    /// 替班：临时替其他员工上班
    /// </summary>
    [Display(Name = "替班")] 替班 = 4,

    /// <summary>
    /// 换班：与其他员工互换班次
    /// </summary>
    [Display(Name = "换班")] 换班 = 5,

    /// <summary>
    /// 正常上班, 将异常考勤标记为正常
    /// </summary>
    [Display(Name = "正常上班")] 正常上班 = 6,

    /// <summary>
    /// 加班：员工在正常工作时间之外的工作
    /// </summary>
    [Display(Name = "加班")] 加班 = 7,

    /// <summary>
    ///  出差：员工因工作需要外出
    /// </summary>
    [Display(Name = "出差")] 出差 = 8
}